package lab03.test01;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Test01 {
    public static void main(String[] args) {
        //字符流读文件
        String path = "D:\\hello.txt";
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(path));

            String line = null;
            //line = reader.readLine()     //读一行
            while ((line = reader.readLine())!=null){         //读多行
                System.out.println(line);
            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    }

